package com.example.project.controller;

import com.example.project.model.bo.LotteryQueryDataVo;
import com.example.project.model.bo.PagingParam;
import com.example.project.service.InputExtBusinessService;
import com.example.project.service.LotteryExtBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created by Administrator on 2017/12/15.
 */
@Controller
public class FillOutController {
    @Autowired
    LotteryExtBusinessService lotteryExtBusinessService;

    @Autowired
    InputExtBusinessService inputExtBusinessService;

    @RequestMapping(value = { "/input"}, method ={ RequestMethod.GET})
    public String getindex(PagingParam pagingParam, Model model) {
        LotteryQueryDataVo lotteryQueryDataVo = lotteryExtBusinessService.loadInputLotteryList(pagingParam);
        model.addAttribute("data",lotteryQueryDataVo);
        model.addAttribute("pagingParam",pagingParam);
        return "input";
    }


    @RequestMapping(value = { "/input"}, method ={RequestMethod.POST})
    public String index(PagingParam pagingParam, Model model, long firstNum,long secondNum,long thirdNum) {
        inputExtBusinessService.inputBonusNum(firstNum,secondNum,thirdNum);
        return getindex(pagingParam,model);
    }
}
